﻿namespace MLog.Core {
    public class SubstituteLogger : BaseLogger {
        private volatile ILogger _delegate;

        public ILogger Delegate {
            get { return _delegate; }
            set { _delegate = value; }
        }

        public override void LogEvent(LoggerEvent @event) {
            if (IsLogTypeAllowed(@event.Level)) {
                var logger = _delegate as BaseLogger;
                if (logger != null) logger.LogEvent(@event);
            }
        }
    }
}